const baserUrl = 'http://localhost:8081/'
// const baserUrl = 'http://api.dyhsw.cn:2858/'

export const request = (url, a, data) => {
  return new Promise((resolve, reject) => {
    uni.request({
      method: 'POST',
      url: baserUrl + url + '/',
      header: Object.assign({
        'Content-Type': 'application/x-www-form-urlencoded'
      }),
      data: {
        a,
        ...data
      },
      success: (res) => {
        resolve(res.data)
      },
      fail: (error) => {
        reject()
      }
    })
  })
}
